package com.offcn.util;


import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

//jdbc工具类
//保证程序运行过程中只有一个连接池对象
public class JdbcUtils {

    private static ComboPooledDataSource dataSource = new ComboPooledDataSource();

    public static Connection getConnection(){
        try {
            return dataSource.getConnection();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
            return null;
        }
    }
    private JdbcUtils(){}
}
